import Vue from 'vue'
import Router from 'vue-router'

import datasource from './children/datasource'
import panel from './children/panel'
import screen from './children/screen'

Vue.use(Router)

const router = new Router({
  routes: [
    ...datasource,
    ...panel,
    ...screen,
    {
      path: '/ui-editor',
      name: 'UIEditor',
      component: () => import('../pages/ui-editor')
    },
    {
        path: '*',
        redirect: '/'
    },
    {
        path: '/',
        meta: { requireAuth: true },
        component:resolve => require(['../pages/welcome.vue'], resolve)
    },
    {
      path: '/graph',
      meta: { requireAuth: true },
      component:resolve => require(['../pages/graph/graph-index.vue'], resolve)
    },
    {
      path: '/graph/add',
      meta: { requireAuth: true },
      component:resolve => require(['../pages/graph/graph.vue'], resolve)
    }
  ]
})

export default router;
